package com.warm.base.design.c_factory;

import com.warm.base.design.c_factory.abstracted.AbstractFactory;
import com.warm.base.design.c_factory.abstracted.ProductA1B1Factory;
import com.warm.base.design.c_factory.method.MethodFactory;
import com.warm.base.design.c_factory.method.ProductAFactory;
import com.warm.base.design.c_factory.method.ProductBFactory;
import com.warm.base.design.c_factory.sample.SimpleFactory;

/**
 * @Date: 2019/11/28 13:57
 * @Author: LChuang
 * @Description:
 */
public class Client {
    /**
     * 1. 简单工程模式不属于 23 GOF 设计模式
     */
    public static void main(String[] args) {

        /**
         * 1. sample factory
         */
        SimpleFactory simpleFactory = new SimpleFactory();
        simpleFactory.getProduct("a1").create();
        simpleFactory.getProduct("a2").create();

        /**
         * 2. factory method
         */
        MethodFactory productAFactory = new ProductAFactory();
        productAFactory.getProduct().create();
        MethodFactory productBFactory = new ProductBFactory();
        productBFactory.getProduct().create();

        /**
         * 3. abstract factory
         */
        AbstractFactory a1b1Factory = new ProductA1B1Factory();
        a1b1Factory.createProductA().create();
        a1b1Factory.createProductB().produce();
    }
}
